<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加医生</title>
    <link href="bootstrap-4.6.1-dist/css/bootstrap.min.css"
          rel="stylesheet"
          type="text/css">
    <style type="text/css">
        #main{
            box-sizing: border-box;
            background-color: #ececf6;
        }
        #form{
            margin-top: -20px;
            padding-top: 50px;
            padding-bottom: 10px;
        }
        #addplace{
            margin-left: 650px;
            margin-right: 10px;
        }
    </style>
</head>
<body style="background-color: #e9ecef">
<!-- 页面内容 -->
<div id="main">
    <nav class="navbar navbar-expand-lg navbar-light" style="background-color: #e3f2fd;">
        <a class="navbar-brand" href="#">菜单</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
                aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav">
                <li class="nav-item">
                    <a class="nav-link" href="Doctor.html">医生管理</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="medicine.html">药品管理</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="Register.html">挂号管理</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link justify-content-end" href="login.html">退出</a>
                </li>
            </ul>
        </div>
    </nav>
    <!-- 输入框 -->
    <form id="form">
        <div class="form-group row">
            <label class="col-form-label col-2 text-center">编号：</label>
            <div class="col-8">
                <input type="text" name="Number" class="form-control" placeholder="*必填">
            </div>
        </div>
        <div class="form-group row">
            <lable class="col-form-label col-2 text-center">医生姓名：</lable>
            <div class="col-8">
                <input type="text" name="Name" class="form-control" placeholder="*必填">
            </div>
        </div>
        <div class="form-group row">
            <lable class="col-form-label col-2 text-center">性别：</lable>
            <div class="col-8">
                <select name="Sex" class="form-control">
                    <option value="" disabled selected hidden>*必填</option>
                    <option value="0">男</option>
                    <option value="1">女</option>
                </select>
            </div>
        </div>
        <div class="form-group row">
            <lable class="col-form-label col-2 text-center">科室：</lable>
            <div class="col-8">
                <select name="Department" class="form-control">
                    <option value="" disabled selected hidden>*必填</option>
                    <option value="a科">a科</option>
                    <option value="b科">b科</option>
                    <option value="c科">c科</option>
                    <option value="d科">d科</option>
                    <option value="e科">e科</option>
                    <option value="f科">f科</option>
                    <option value="g科">g科</option>
                    <option value="h科">h科</option>
                </select>
            </div>
        </div>
        <div class="form-group row">
            <lable class="col-form-label col-2 text-center">状态：</lable>
            <div class="col-8">
                <select name="State" class="form-control">
                    <option value="" disabled selected hidden></option>
                    <option value="" disabled selected hidden>*必填</option>
                    <option value="0">已离职</option>
                    <option value="1">在职</option>
                </select>
            </div>
        </div>
        <div class="form-group row">
            <lable class="col-form-label col-2 text-center">电话：</lable>
            <div class="col-8">
                <input type="text" name="Phone" class="form-control">
            </div>
        </div>
        <!-- 确认按钮 -->
        <div class="form-group row">
            <!-- 添加空白的东西让按钮居中 -->
            <div id="addplace">
                <button type="button" id="btnReg" class="btn btn-success">添加</button>
            </div>
            <div>
                <button type="reset" id="btnReset" class="btn btn-secondary">重置</button>
            </div>
        </div>
</div>
</body>
<!-- 提交给服务器 -->
<script src="jQuery/jquery-3.6.0.min.js"></script>
<script>
// 点击--整合，发
    jQuery(function () {
        jQuery("#btnReg").click(function () {
            let form = jQuery("#form").serialize();
            jQuery.post("user/doctor_add",form,function (post_return) {
                if (post_return==1) {
                    alert("添加成功");
                    window.location.href="Doctor_add.html";    // 更新
                }else{
                    alert("添加失败");
                }
            });
        });
    })
</script>
</html>